//
//  BZGlobalCommonHeader.h
//  Pods
//
//  Created by quheng on 2017/9/25.
//
//

#ifndef BZGlobalCommonHeader_h
#define BZGlobalCommonHeader_h


#define qiniuDomain @"img.zzf.sos-life.com"

#define MY_PROJECT_GLOBAL_CONTROL 0



#if (MY_PROJECT_GLOBAL_CONTROL == 0) //测试环境

#define HTTPHost @"http://test.api.zzf.sos-life.com/"


#elif (MY_PROJECT_GLOBAL_CONTROL == 1) //预生产环境

#define HTTPHost @""


#elif (MY_PROJECT_GLOBAL_CONTROL == 2) //生产环境

#define HTTPHost @""

#endif



//登录API通知
#define BZLoginOut     @"BZLoginOut"
#define BZLoginSuccess @"BZLoginSuccess"
#define BZLoginFailed  @"BZLoginFailed"



//----------------------打印日志-------------------------
//DEBUG  模式下打印日志,当前行
#ifdef DEBUG
#   define BZLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define BZLog(...)
#endif

//DEBUG  模式下打印日志,当前行 并弹出一个警告
#ifdef DEBUG
#   define ULog(fmt, ...)  { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__]  delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
#   define ULog(...)
#endif


#define BZDEBUG
#define BZLOGLEVEL_INFO     1000
#define BZLOGLEVEL_WARNING  3
#define BZLOGLEVEL_ERROR    1

#ifndef BZMAXLOGLEVEL

#ifdef DEBUG
#define BZMAXLOGLEVEL BZLOGLEVEL_INFO
#else
#define BZMAXLOGLEVEL BZLOGLEVEL_ERROR
#endif

#endif

// The general purpose logger. This ignores logging levels.
#ifdef BZDEBUG
#define BZPRINT(xx, ...)  NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define BZPRINT(xx, ...)  ((void)0)
#endif

// Prints the current method's name.
#define BZPRINTMETHODNAME() BZPRINT(@"%s", __PRETTY_FUNCTION__)

// Log-level based logging macros.
#if BZLOGLEVEL_ERROR <= BZMAXLOGLEVEL
#define BZERROR(xx, ...)  BZPRINT(xx, ##__VA_ARGS__)
#else
#define BZERROR(xx, ...)  ((void)0)
#endif

#if BZLOGLEVEL_WARNING <= BZMAXLOGLEVEL
#define BZWARNING(xx, ...)  BZPRINT(xx, ##__VA_ARGS__)
#else
#define BZWARNING(xx, ...)  ((void)0)
#endif

#if BZLOGLEVEL_INFO <= BZMAXLOGLEVEL
#define BZINFO(xx, ...)  BZPRINT(xx, ##__VA_ARGS__)
#else
#define BZINFO(xx, ...)  ((void)0)
#endif

#ifdef BZDEBUG
#define BZCONDITIONLOG(condition, xx, ...) { if ((condition)) { \
BZPRINT(xx, ##__VA_ARGS__); \
} \
} ((void)0)
#else
#define BZCONDITIONLOG(condition, xx, ...) ((void)0)
#endif

#define BZAssert(condition, ...)                                       \
do {                                                                      \
if (!(condition)) {                                                     \
[[NSAssertionHandler currentHandler]                                  \
handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
file:[NSString stringWithUTF8String:__FILE__]  \
lineNumber:__LINE__                                  \
description:__VA_ARGS__];                             \
}                                                                       \
} while(0)

#endif /* BZGlobalCommonHeader_h */
